#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
int main()
{
    int F1, F2, J1, J2, J3;
    cin >> F1 >> F2;
    cin >> J1 >> J2 >> J3;
    if (F1 > F2)
    {
        if (J1 == 1 && J1 == J2 && J2 == J3)
        {
            cout << "The winner is b: " << F2 << " + " << 3 << endl;
        }
        else
            cout << "The winner is a: " << F1 << " + " << 3 - (J1 + J2 + J3) << endl;
    }
    else
    {
        if (J1 == 0 && J1 == J2 && J2 == J3)
        {
            cout << "The winner is a: " << F1 << " + " << 3 << endl;
        }
        else
            cout << "The winner is b: " << F2 << " + " << J1 + J2 + J3 << endl;
    }
    return 0;
}
